<?php
class GoodsCategory extends BaseBean{
    
    protected $_table= "tb_goods_category";
    protected $_primarykey= "id";
    protected $_table_alias= "a";
    protected $_mustFields =array("code"=>"商品编号","brand_id"=>"型号");
    protected $_uniqueFields =array("a.code"=>"商品编号");

    public function __construct(){
        $this->addChild("GoodsPrice","id","goods_id");
    }

   


    public function generateSql(){
        return "select a.*,b.name as brand,c.name as model,d.name as unit, a.code+' '+b.name+' '+c.name as display_name from tb_goods_category a 
                left join tb_brand b on a.brand_id=b.id 
                left join tb_type c on a.type_id=c.id 
                left join tb_unit d on a.unit_id=d.id  ";
    }

   
  
}
?>